<?php
namespace App\Modules\Article;

use App\Modules\AdapterApi;
use App\Services\Article\ArticleIndex;

/**
 * 文章分类应用层
 * Class ApiArticleClassify
 * @package App\Modules\Article
 */
class ApiArticleClassify extends AdapterApi
{
//--------------------------------企业站前台开始------------------------------------------
    /**
     * 文章分类列表
     */
    public function articleClass()
    {
        return ArticleIndex::ApiArticleClassify()->articleClass();
    }

    /**
     * 指定文章分类
     */
    public function assignClass()
    {
        $data = pick_array($this->postData,['pid']);
        return ArticleIndex::ApiArticleClassify()->assignClass($data);
    }

//--------------------------------企业站前台结束------------------------------------------

//--------------------------------APP前台开始----------------------------------------------
    /**
     * 获取APP文章全部分类列表
     */
    public function appClassifyList()
    {
        return ArticleIndex::ApiArticleClassify()->appClassifyList();
    }
//--------------------------------APP前台结束----------------------------------------------
    /**
     * 获取文章全部分类列表
     */
    public function classifyList()
    {
        return ArticleIndex::ApiArticleClassify()->classifyList();
    }

    /**
     * 获取文章全部分类列表（不分页）
     */
    public function themeList()
    {
        return ArticleIndex::ApiArticleClassify()->themeList();
    }

    /**
     * 文章分类的添加
     */
    public function add()
    {
        $data = pick_array($this->postData, ["name", 'belong_to', 'user_id']);

        return ArticleIndex::ApiArticleClassify()->add($data);
    }

    /**
     * 文章分类编辑
     */
    public function edit()
    {
        $data= pick_array($this->postData, ["id", "name", "description", "belong_to"]);

        return ArticleIndex::ApiArticleClassify()->edit($data);
    }

    /**
     * 删除文章分类
     */
    public function classifyDelete()
    {
        $data = pick_array($this->postData, ['id', "key"]);

        return ArticleIndex::ApiArticleClassify()->classifyDelete($data);
    }

    /**
     * 启用某文章分类
     */
    public function classifyEnable()
    {
        $data = pick_array($this->postData,['id', "key"]);

        return ArticleIndex::ApiArticleClassify()->classifyEnable($data);
    }

    /**
     * 禁用某文章分类
     */
    public function classifyDisable()
    {
        $data = pick_array($this->postData,['id', "key"]);

        return ArticleIndex::ApiArticleClassify()->classifyDisable($data);
    }

    /**
     * 获取某一类文章分类
     */
    public function classifySomeList()
    {
        $data = pick_array($this->postData,['pid', "key"]);

        return ArticleIndex::ApiArticleClassify()->classifySomeList($data);
    }

    /**
     * 不同条件文章分类列表获取
     */
    public function classifyCondition()
    {
        $data = pick_array($this->postData,['keywords','page','listRows']);

        return ArticleIndex::ApiArticleClassify()->classifyCondition($data);
    }

    /**
     * 获取文章主题信息
     */
    public function classifyInfo()
    {
        $data = pick_array($this->postData, ['id']);

        return ArticleIndex::ApiArticleClassify()->classifyInfo($data);
    }
}
